<?php

namespace App\Repositories;

use App\Models\Consociation;
use Illuminate\Database\Eloquent\Model;

class ConsociationRepository extends BaseRepository
{
	public function model()
	{
		return Consociation::class;
	}

    /**
     * 获取合作公司数据
     * @param $company
     * @param bool $initiator
     * @param bool $project
     * @return $this
     */
	public function getByCompany($company, $initiator = false, $project = false)
	{
		$this->where('partner', '=', $company);
		if ($initiator) {
			$this->where('initiator', '=', $initiator);
		}
		if ($project) {
		    $this->where('project_id', '=', $project);
        }

        $this->with('initiator','project');
		return $this;
	}

    /**
     * 获取状态
     * @param $status
     * @return $this
     */
	public function getByStatus($status)
    {
        $this->where('status', '=', $status);

        return $this;
    }



	protected function serialization(array $attributes)
	{
		// TODO: Implement serialization() method.
	}

}
